package zxing.activity.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;

import java.util.List;

import io.virtualapp.R;
import io.virtualapp.bean.Icon;
import io.virtualapp.bean.SongBean;

import com.chad.library.adapter.base.BaseViewHolder;

/********************
 *  Created by ：  lyq 
 *         Date：  2018\11\19 0019.
 * Introduction：   
 *********************/

public class IconAdapter extends BaseQuickAdapter<Icon, BaseViewHolder> {
    private int position1 = -1;
    private List<Icon> datas;

    public IconAdapter(Context context, @Nullable List<Icon> data) {
        super(R.layout.icon_item, data);
        this.datas = data;
    }

    @Override
    protected void convert(BaseViewHolder helper, Icon item) {
        helper.addOnClickListener(R.id.image_lin);
        helper.setImageResource(R.id.icon_image, item.getImageId());
        if (position1 == helper.getLayoutPosition()) {
            helper.setVisible(R.id.icon_bg, true);
        } else {
            helper.setVisible(R.id.icon_bg, false);
        }
    }

    public void setsele(int position1) {
        this.position1 = position1;
        notifyDataSetChanged();
    }

}
